﻿///////////////////////////////////////////////////////////////
// This is generated code. 
//////////////////////////////////////////////////////////////
// Code is generated using LLBLGen Pro version: 2.6
// Code is generated on: 2011年7月5日 11:37:44
// Code is generated using templates: SD.TemplateBindings.SharedTemplates.NET20
// Templates vendor: Solutions Design.
// Templates version: 
//////////////////////////////////////////////////////////////
using System;
using System.Collections.Generic;
using CARMSData.HelperClasses;

using CARMSData.EntityClasses;
using CARMSData.RelationClasses;
using CARMSData.DaoClasses;
using CARMSData.CollectionClasses;
using SD.LLBLGen.Pro.ORMSupportClasses;

namespace CARMSData.FactoryClasses
{
	
	// __LLBLGENPRO_USER_CODE_REGION_START AdditionalNamespaces
	// __LLBLGENPRO_USER_CODE_REGION_END
	
	/// <summary>general base class for the generated factories</summary>
	[Serializable]
	public partial class EntityFactoryBase : EntityFactoryCore
	{
		private string _entityName;
		private CARMSData.EntityType _typeOfEntity;
		
		/// <summary>CTor</summary>
		/// <param name="entityName">Name of the entity.</param>
		/// <param name="typeOfEntity">The type of entity.</param>
		public EntityFactoryBase(string entityName, CARMSData.EntityType typeOfEntity)
		{
			_entityName = entityName;
			_typeOfEntity = typeOfEntity;
		}

		/// <summary>Creates a new entity instance using the GeneralEntityFactory in the generated code, using the passed in entitytype value</summary>
		/// <param name="entityTypeValue">The entity type value of the entity to create an instance for.</param>
		/// <returns>new IEntity instance</returns>
		public override IEntity CreateEntityFromEntityTypeValue(int entityTypeValue)
		{
			return GeneralEntityFactory.Create((CARMSData.EntityType)entityTypeValue);
		}
		
		/// <summary>Creates, using the generated EntityFieldsFactory, the IEntityFields object for the entity to create. </summary>
		/// <returns>Empty IEntityFields object.</returns>
		public override IEntityFields CreateFields()
		{
			return EntityFieldsFactory.CreateEntityFieldsObject(_typeOfEntity);
		}

		/// <summary>Creates the relations collection to the entity to join all targets so this entity can be fetched. </summary>
		/// <param name="objectAlias">The object alias to use for the elements in the relations.</param>
		/// <returns>null if the entity isn't in a hierarchy of type TargetPerEntity, otherwise the relations collection needed to join all targets together to fetch all subtypes of this entity and this entity itself</returns>
		public override IRelationCollection CreateHierarchyRelations(string objectAlias) 
		{
			return InheritanceInfoProviderSingleton.GetInstance().GetHierarchyRelations(_entityName, objectAlias);
		}

		/// <summary>This method retrieves, using the InheritanceInfoprovider, the factory for the entity represented by the values passed in.</summary>
		/// <param name="fieldValues">Field values read from the db, to determine which factory to return, based on the field values passed in.</param>
		/// <param name="entityFieldStartIndexesPerEntity">indexes into values where per entity type their own fields start.</param>
		/// <returns>the factory for the entity which is represented by the values passed in.</returns>
		public override IEntityFactory GetEntityFactory(object[] fieldValues, Dictionary<string, int> entityFieldStartIndexesPerEntity)
		{
			IEntityFactory toReturn = (IEntityFactory)InheritanceInfoProviderSingleton.GetInstance().GetEntityFactory(_entityName, fieldValues, entityFieldStartIndexesPerEntity);
			if(toReturn == null)
			{
				toReturn = this;
			}
			return toReturn;
		}
						
		/// <summary>Creates a new entity collection for the entity of this factory.</summary>
		/// <returns>ready to use new entity collection, typed.</returns>
		public override IEntityCollection CreateEntityCollection()
		{
			return GeneralEntityCollectionFactory.Create(_typeOfEntity);
		}
		
		/// <summary>returns the name of the entity this factory is for, e.g. "EmployeeEntity"</summary>
		public override string ForEntityName 
		{ 
			get { return _entityName; }
		}
	}
	
	/// <summary>Factory to create new, empty ActionEntity objects.</summary>
	[Serializable]
	public partial class ActionEntityFactory : EntityFactoryBase {
		/// <summary>CTor</summary>
		public ActionEntityFactory() : base("ActionEntity", CARMSData.EntityType.ActionEntity) { }

		/// <summary>Creates a new, empty ActionEntity object.</summary>
		/// <returns>A new, empty ActionEntity object.</returns>
		public override IEntity Create() {
			IEntity toReturn = new ActionEntity();
			
			// __LLBLGENPRO_USER_CODE_REGION_START CreateNewAction
			// __LLBLGENPRO_USER_CODE_REGION_END
			return toReturn;
		}
		
		/// <summary>Creates a new ActionEntity instance and will set the Fields object of the new IEntity instance to the passed in fields object.</summary>
		/// <param name="fields">Populated IEntityFields object for the new IEntity to create</param>
		/// <returns>Fully created and populated (due to the IEntityFields object) IEntity object</returns>
		public override IEntity Create(IEntityFields fields) {
			IEntity toReturn = Create();
			toReturn.Fields = fields;
			
			// __LLBLGENPRO_USER_CODE_REGION_START CreateNewActionUsingFields
			// __LLBLGENPRO_USER_CODE_REGION_END
			return toReturn;
		}

		#region Included Code

		#endregion
	}
	
	/// <summary>Factory to create new, empty ActionGridColumnEntity objects.</summary>
	[Serializable]
	public partial class ActionGridColumnEntityFactory : EntityFactoryBase {
		/// <summary>CTor</summary>
		public ActionGridColumnEntityFactory() : base("ActionGridColumnEntity", CARMSData.EntityType.ActionGridColumnEntity) { }

		/// <summary>Creates a new, empty ActionGridColumnEntity object.</summary>
		/// <returns>A new, empty ActionGridColumnEntity object.</returns>
		public override IEntity Create() {
			IEntity toReturn = new ActionGridColumnEntity();
			
			// __LLBLGENPRO_USER_CODE_REGION_START CreateNewActionGridColumn
			// __LLBLGENPRO_USER_CODE_REGION_END
			return toReturn;
		}
		
		/// <summary>Creates a new ActionGridColumnEntity instance and will set the Fields object of the new IEntity instance to the passed in fields object.</summary>
		/// <param name="fields">Populated IEntityFields object for the new IEntity to create</param>
		/// <returns>Fully created and populated (due to the IEntityFields object) IEntity object</returns>
		public override IEntity Create(IEntityFields fields) {
			IEntity toReturn = Create();
			toReturn.Fields = fields;
			
			// __LLBLGENPRO_USER_CODE_REGION_START CreateNewActionGridColumnUsingFields
			// __LLBLGENPRO_USER_CODE_REGION_END
			return toReturn;
		}

		#region Included Code

		#endregion
	}
	
	/// <summary>Factory to create new, empty ColumnToActionEntity objects.</summary>
	[Serializable]
	public partial class ColumnToActionEntityFactory : EntityFactoryBase {
		/// <summary>CTor</summary>
		public ColumnToActionEntityFactory() : base("ColumnToActionEntity", CARMSData.EntityType.ColumnToActionEntity) { }

		/// <summary>Creates a new, empty ColumnToActionEntity object.</summary>
		/// <returns>A new, empty ColumnToActionEntity object.</returns>
		public override IEntity Create() {
			IEntity toReturn = new ColumnToActionEntity();
			
			// __LLBLGENPRO_USER_CODE_REGION_START CreateNewColumnToAction
			// __LLBLGENPRO_USER_CODE_REGION_END
			return toReturn;
		}
		
		/// <summary>Creates a new ColumnToActionEntity instance and will set the Fields object of the new IEntity instance to the passed in fields object.</summary>
		/// <param name="fields">Populated IEntityFields object for the new IEntity to create</param>
		/// <returns>Fully created and populated (due to the IEntityFields object) IEntity object</returns>
		public override IEntity Create(IEntityFields fields) {
			IEntity toReturn = Create();
			toReturn.Fields = fields;
			
			// __LLBLGENPRO_USER_CODE_REGION_START CreateNewColumnToActionUsingFields
			// __LLBLGENPRO_USER_CODE_REGION_END
			return toReturn;
		}

		#region Included Code

		#endregion
	}
	
	/// <summary>Factory to create new, empty CompanyEntity objects.</summary>
	[Serializable]
	public partial class CompanyEntityFactory : EntityFactoryBase {
		/// <summary>CTor</summary>
		public CompanyEntityFactory() : base("CompanyEntity", CARMSData.EntityType.CompanyEntity) { }

		/// <summary>Creates a new, empty CompanyEntity object.</summary>
		/// <returns>A new, empty CompanyEntity object.</returns>
		public override IEntity Create() {
			IEntity toReturn = new CompanyEntity();
			
			// __LLBLGENPRO_USER_CODE_REGION_START CreateNewCompany
			// __LLBLGENPRO_USER_CODE_REGION_END
			return toReturn;
		}
		
		/// <summary>Creates a new CompanyEntity instance and will set the Fields object of the new IEntity instance to the passed in fields object.</summary>
		/// <param name="fields">Populated IEntityFields object for the new IEntity to create</param>
		/// <returns>Fully created and populated (due to the IEntityFields object) IEntity object</returns>
		public override IEntity Create(IEntityFields fields) {
			IEntity toReturn = Create();
			toReturn.Fields = fields;
			
			// __LLBLGENPRO_USER_CODE_REGION_START CreateNewCompanyUsingFields
			// __LLBLGENPRO_USER_CODE_REGION_END
			return toReturn;
		}

		#region Included Code

		#endregion
	}
	
	/// <summary>Factory to create new, empty ConfigurationEntity objects.</summary>
	[Serializable]
	public partial class ConfigurationEntityFactory : EntityFactoryBase {
		/// <summary>CTor</summary>
		public ConfigurationEntityFactory() : base("ConfigurationEntity", CARMSData.EntityType.ConfigurationEntity) { }

		/// <summary>Creates a new, empty ConfigurationEntity object.</summary>
		/// <returns>A new, empty ConfigurationEntity object.</returns>
		public override IEntity Create() {
			IEntity toReturn = new ConfigurationEntity();
			
			// __LLBLGENPRO_USER_CODE_REGION_START CreateNewConfiguration
			// __LLBLGENPRO_USER_CODE_REGION_END
			return toReturn;
		}
		
		/// <summary>Creates a new ConfigurationEntity instance and will set the Fields object of the new IEntity instance to the passed in fields object.</summary>
		/// <param name="fields">Populated IEntityFields object for the new IEntity to create</param>
		/// <returns>Fully created and populated (due to the IEntityFields object) IEntity object</returns>
		public override IEntity Create(IEntityFields fields) {
			IEntity toReturn = Create();
			toReturn.Fields = fields;
			
			// __LLBLGENPRO_USER_CODE_REGION_START CreateNewConfigurationUsingFields
			// __LLBLGENPRO_USER_CODE_REGION_END
			return toReturn;
		}

		#region Included Code

		#endregion
	}
	
	/// <summary>Factory to create new, empty CountryEntity objects.</summary>
	[Serializable]
	public partial class CountryEntityFactory : EntityFactoryBase {
		/// <summary>CTor</summary>
		public CountryEntityFactory() : base("CountryEntity", CARMSData.EntityType.CountryEntity) { }

		/// <summary>Creates a new, empty CountryEntity object.</summary>
		/// <returns>A new, empty CountryEntity object.</returns>
		public override IEntity Create() {
			IEntity toReturn = new CountryEntity();
			
			// __LLBLGENPRO_USER_CODE_REGION_START CreateNewCountry
			// __LLBLGENPRO_USER_CODE_REGION_END
			return toReturn;
		}
		
		/// <summary>Creates a new CountryEntity instance and will set the Fields object of the new IEntity instance to the passed in fields object.</summary>
		/// <param name="fields">Populated IEntityFields object for the new IEntity to create</param>
		/// <returns>Fully created and populated (due to the IEntityFields object) IEntity object</returns>
		public override IEntity Create(IEntityFields fields) {
			IEntity toReturn = Create();
			toReturn.Fields = fields;
			
			// __LLBLGENPRO_USER_CODE_REGION_START CreateNewCountryUsingFields
			// __LLBLGENPRO_USER_CODE_REGION_END
			return toReturn;
		}

		#region Included Code

		#endregion
	}
	
	/// <summary>Factory to create new, empty CustomerEntity objects.</summary>
	[Serializable]
	public partial class CustomerEntityFactory : EntityFactoryBase {
		/// <summary>CTor</summary>
		public CustomerEntityFactory() : base("CustomerEntity", CARMSData.EntityType.CustomerEntity) { }

		/// <summary>Creates a new, empty CustomerEntity object.</summary>
		/// <returns>A new, empty CustomerEntity object.</returns>
		public override IEntity Create() {
			IEntity toReturn = new CustomerEntity();
			
			// __LLBLGENPRO_USER_CODE_REGION_START CreateNewCustomer
			// __LLBLGENPRO_USER_CODE_REGION_END
			return toReturn;
		}
		
		/// <summary>Creates a new CustomerEntity instance and will set the Fields object of the new IEntity instance to the passed in fields object.</summary>
		/// <param name="fields">Populated IEntityFields object for the new IEntity to create</param>
		/// <returns>Fully created and populated (due to the IEntityFields object) IEntity object</returns>
		public override IEntity Create(IEntityFields fields) {
			IEntity toReturn = Create();
			toReturn.Fields = fields;
			
			// __LLBLGENPRO_USER_CODE_REGION_START CreateNewCustomerUsingFields
			// __LLBLGENPRO_USER_CODE_REGION_END
			return toReturn;
		}

		#region Included Code

		#endregion
	}
	
	/// <summary>Factory to create new, empty DepartmentEntity objects.</summary>
	[Serializable]
	public partial class DepartmentEntityFactory : EntityFactoryBase {
		/// <summary>CTor</summary>
		public DepartmentEntityFactory() : base("DepartmentEntity", CARMSData.EntityType.DepartmentEntity) { }

		/// <summary>Creates a new, empty DepartmentEntity object.</summary>
		/// <returns>A new, empty DepartmentEntity object.</returns>
		public override IEntity Create() {
			IEntity toReturn = new DepartmentEntity();
			
			// __LLBLGENPRO_USER_CODE_REGION_START CreateNewDepartment
			// __LLBLGENPRO_USER_CODE_REGION_END
			return toReturn;
		}
		
		/// <summary>Creates a new DepartmentEntity instance and will set the Fields object of the new IEntity instance to the passed in fields object.</summary>
		/// <param name="fields">Populated IEntityFields object for the new IEntity to create</param>
		/// <returns>Fully created and populated (due to the IEntityFields object) IEntity object</returns>
		public override IEntity Create(IEntityFields fields) {
			IEntity toReturn = Create();
			toReturn.Fields = fields;
			
			// __LLBLGENPRO_USER_CODE_REGION_START CreateNewDepartmentUsingFields
			// __LLBLGENPRO_USER_CODE_REGION_END
			return toReturn;
		}

		#region Included Code

		#endregion
	}
	
	/// <summary>Factory to create new, empty DictionaryEntity objects.</summary>
	[Serializable]
	public partial class DictionaryEntityFactory : EntityFactoryBase {
		/// <summary>CTor</summary>
		public DictionaryEntityFactory() : base("DictionaryEntity", CARMSData.EntityType.DictionaryEntity) { }

		/// <summary>Creates a new, empty DictionaryEntity object.</summary>
		/// <returns>A new, empty DictionaryEntity object.</returns>
		public override IEntity Create() {
			IEntity toReturn = new DictionaryEntity();
			
			// __LLBLGENPRO_USER_CODE_REGION_START CreateNewDictionary
			// __LLBLGENPRO_USER_CODE_REGION_END
			return toReturn;
		}
		
		/// <summary>Creates a new DictionaryEntity instance and will set the Fields object of the new IEntity instance to the passed in fields object.</summary>
		/// <param name="fields">Populated IEntityFields object for the new IEntity to create</param>
		/// <returns>Fully created and populated (due to the IEntityFields object) IEntity object</returns>
		public override IEntity Create(IEntityFields fields) {
			IEntity toReturn = Create();
			toReturn.Fields = fields;
			
			// __LLBLGENPRO_USER_CODE_REGION_START CreateNewDictionaryUsingFields
			// __LLBLGENPRO_USER_CODE_REGION_END
			return toReturn;
		}

		#region Included Code

		#endregion
	}
	
	/// <summary>Factory to create new, empty DictionaryCategoryEntity objects.</summary>
	[Serializable]
	public partial class DictionaryCategoryEntityFactory : EntityFactoryBase {
		/// <summary>CTor</summary>
		public DictionaryCategoryEntityFactory() : base("DictionaryCategoryEntity", CARMSData.EntityType.DictionaryCategoryEntity) { }

		/// <summary>Creates a new, empty DictionaryCategoryEntity object.</summary>
		/// <returns>A new, empty DictionaryCategoryEntity object.</returns>
		public override IEntity Create() {
			IEntity toReturn = new DictionaryCategoryEntity();
			
			// __LLBLGENPRO_USER_CODE_REGION_START CreateNewDictionaryCategory
			// __LLBLGENPRO_USER_CODE_REGION_END
			return toReturn;
		}
		
		/// <summary>Creates a new DictionaryCategoryEntity instance and will set the Fields object of the new IEntity instance to the passed in fields object.</summary>
		/// <param name="fields">Populated IEntityFields object for the new IEntity to create</param>
		/// <returns>Fully created and populated (due to the IEntityFields object) IEntity object</returns>
		public override IEntity Create(IEntityFields fields) {
			IEntity toReturn = Create();
			toReturn.Fields = fields;
			
			// __LLBLGENPRO_USER_CODE_REGION_START CreateNewDictionaryCategoryUsingFields
			// __LLBLGENPRO_USER_CODE_REGION_END
			return toReturn;
		}

		#region Included Code

		#endregion
	}
	
	/// <summary>Factory to create new, empty G100Entity objects.</summary>
	[Serializable]
	public partial class G100EntityFactory : EntityFactoryBase {
		/// <summary>CTor</summary>
		public G100EntityFactory() : base("G100Entity", CARMSData.EntityType.G100Entity) { }

		/// <summary>Creates a new, empty G100Entity object.</summary>
		/// <returns>A new, empty G100Entity object.</returns>
		public override IEntity Create() {
			IEntity toReturn = new G100Entity();
			
			// __LLBLGENPRO_USER_CODE_REGION_START CreateNewG100
			// __LLBLGENPRO_USER_CODE_REGION_END
			return toReturn;
		}
		
		/// <summary>Creates a new G100Entity instance and will set the Fields object of the new IEntity instance to the passed in fields object.</summary>
		/// <param name="fields">Populated IEntityFields object for the new IEntity to create</param>
		/// <returns>Fully created and populated (due to the IEntityFields object) IEntity object</returns>
		public override IEntity Create(IEntityFields fields) {
			IEntity toReturn = Create();
			toReturn.Fields = fields;
			
			// __LLBLGENPRO_USER_CODE_REGION_START CreateNewG100UsingFields
			// __LLBLGENPRO_USER_CODE_REGION_END
			return toReturn;
		}

		#region Included Code

		#endregion
	}
	
	/// <summary>Factory to create new, empty G102Entity objects.</summary>
	[Serializable]
	public partial class G102EntityFactory : EntityFactoryBase {
		/// <summary>CTor</summary>
		public G102EntityFactory() : base("G102Entity", CARMSData.EntityType.G102Entity) { }

		/// <summary>Creates a new, empty G102Entity object.</summary>
		/// <returns>A new, empty G102Entity object.</returns>
		public override IEntity Create() {
			IEntity toReturn = new G102Entity();
			
			// __LLBLGENPRO_USER_CODE_REGION_START CreateNewG102
			// __LLBLGENPRO_USER_CODE_REGION_END
			return toReturn;
		}
		
		/// <summary>Creates a new G102Entity instance and will set the Fields object of the new IEntity instance to the passed in fields object.</summary>
		/// <param name="fields">Populated IEntityFields object for the new IEntity to create</param>
		/// <returns>Fully created and populated (due to the IEntityFields object) IEntity object</returns>
		public override IEntity Create(IEntityFields fields) {
			IEntity toReturn = Create();
			toReturn.Fields = fields;
			
			// __LLBLGENPRO_USER_CODE_REGION_START CreateNewG102UsingFields
			// __LLBLGENPRO_USER_CODE_REGION_END
			return toReturn;
		}

		#region Included Code

		#endregion
	}
	
	/// <summary>Factory to create new, empty G103Entity objects.</summary>
	[Serializable]
	public partial class G103EntityFactory : EntityFactoryBase {
		/// <summary>CTor</summary>
		public G103EntityFactory() : base("G103Entity", CARMSData.EntityType.G103Entity) { }

		/// <summary>Creates a new, empty G103Entity object.</summary>
		/// <returns>A new, empty G103Entity object.</returns>
		public override IEntity Create() {
			IEntity toReturn = new G103Entity();
			
			// __LLBLGENPRO_USER_CODE_REGION_START CreateNewG103
			// __LLBLGENPRO_USER_CODE_REGION_END
			return toReturn;
		}
		
		/// <summary>Creates a new G103Entity instance and will set the Fields object of the new IEntity instance to the passed in fields object.</summary>
		/// <param name="fields">Populated IEntityFields object for the new IEntity to create</param>
		/// <returns>Fully created and populated (due to the IEntityFields object) IEntity object</returns>
		public override IEntity Create(IEntityFields fields) {
			IEntity toReturn = Create();
			toReturn.Fields = fields;
			
			// __LLBLGENPRO_USER_CODE_REGION_START CreateNewG103UsingFields
			// __LLBLGENPRO_USER_CODE_REGION_END
			return toReturn;
		}

		#region Included Code

		#endregion
	}
	
	/// <summary>Factory to create new, empty G131Entity objects.</summary>
	[Serializable]
	public partial class G131EntityFactory : EntityFactoryBase {
		/// <summary>CTor</summary>
		public G131EntityFactory() : base("G131Entity", CARMSData.EntityType.G131Entity) { }

		/// <summary>Creates a new, empty G131Entity object.</summary>
		/// <returns>A new, empty G131Entity object.</returns>
		public override IEntity Create() {
			IEntity toReturn = new G131Entity();
			
			// __LLBLGENPRO_USER_CODE_REGION_START CreateNewG131
			// __LLBLGENPRO_USER_CODE_REGION_END
			return toReturn;
		}
		
		/// <summary>Creates a new G131Entity instance and will set the Fields object of the new IEntity instance to the passed in fields object.</summary>
		/// <param name="fields">Populated IEntityFields object for the new IEntity to create</param>
		/// <returns>Fully created and populated (due to the IEntityFields object) IEntity object</returns>
		public override IEntity Create(IEntityFields fields) {
			IEntity toReturn = Create();
			toReturn.Fields = fields;
			
			// __LLBLGENPRO_USER_CODE_REGION_START CreateNewG131UsingFields
			// __LLBLGENPRO_USER_CODE_REGION_END
			return toReturn;
		}

		#region Included Code

		#endregion
	}
	
	/// <summary>Factory to create new, empty G132Entity objects.</summary>
	[Serializable]
	public partial class G132EntityFactory : EntityFactoryBase {
		/// <summary>CTor</summary>
		public G132EntityFactory() : base("G132Entity", CARMSData.EntityType.G132Entity) { }

		/// <summary>Creates a new, empty G132Entity object.</summary>
		/// <returns>A new, empty G132Entity object.</returns>
		public override IEntity Create() {
			IEntity toReturn = new G132Entity();
			
			// __LLBLGENPRO_USER_CODE_REGION_START CreateNewG132
			// __LLBLGENPRO_USER_CODE_REGION_END
			return toReturn;
		}
		
		/// <summary>Creates a new G132Entity instance and will set the Fields object of the new IEntity instance to the passed in fields object.</summary>
		/// <param name="fields">Populated IEntityFields object for the new IEntity to create</param>
		/// <returns>Fully created and populated (due to the IEntityFields object) IEntity object</returns>
		public override IEntity Create(IEntityFields fields) {
			IEntity toReturn = Create();
			toReturn.Fields = fields;
			
			// __LLBLGENPRO_USER_CODE_REGION_START CreateNewG132UsingFields
			// __LLBLGENPRO_USER_CODE_REGION_END
			return toReturn;
		}

		#region Included Code

		#endregion
	}
	
	/// <summary>Factory to create new, empty GlossaryEntity objects.</summary>
	[Serializable]
	public partial class GlossaryEntityFactory : EntityFactoryBase {
		/// <summary>CTor</summary>
		public GlossaryEntityFactory() : base("GlossaryEntity", CARMSData.EntityType.GlossaryEntity) { }

		/// <summary>Creates a new, empty GlossaryEntity object.</summary>
		/// <returns>A new, empty GlossaryEntity object.</returns>
		public override IEntity Create() {
			IEntity toReturn = new GlossaryEntity();
			
			// __LLBLGENPRO_USER_CODE_REGION_START CreateNewGlossary
			// __LLBLGENPRO_USER_CODE_REGION_END
			return toReturn;
		}
		
		/// <summary>Creates a new GlossaryEntity instance and will set the Fields object of the new IEntity instance to the passed in fields object.</summary>
		/// <param name="fields">Populated IEntityFields object for the new IEntity to create</param>
		/// <returns>Fully created and populated (due to the IEntityFields object) IEntity object</returns>
		public override IEntity Create(IEntityFields fields) {
			IEntity toReturn = Create();
			toReturn.Fields = fields;
			
			// __LLBLGENPRO_USER_CODE_REGION_START CreateNewGlossaryUsingFields
			// __LLBLGENPRO_USER_CODE_REGION_END
			return toReturn;
		}

		#region Included Code

		#endregion
	}
	
	/// <summary>Factory to create new, empty LogEntity objects.</summary>
	[Serializable]
	public partial class LogEntityFactory : EntityFactoryBase {
		/// <summary>CTor</summary>
		public LogEntityFactory() : base("LogEntity", CARMSData.EntityType.LogEntity) { }

		/// <summary>Creates a new, empty LogEntity object.</summary>
		/// <returns>A new, empty LogEntity object.</returns>
		public override IEntity Create() {
			IEntity toReturn = new LogEntity();
			
			// __LLBLGENPRO_USER_CODE_REGION_START CreateNewLog
			// __LLBLGENPRO_USER_CODE_REGION_END
			return toReturn;
		}
		
		/// <summary>Creates a new LogEntity instance and will set the Fields object of the new IEntity instance to the passed in fields object.</summary>
		/// <param name="fields">Populated IEntityFields object for the new IEntity to create</param>
		/// <returns>Fully created and populated (due to the IEntityFields object) IEntity object</returns>
		public override IEntity Create(IEntityFields fields) {
			IEntity toReturn = Create();
			toReturn.Fields = fields;
			
			// __LLBLGENPRO_USER_CODE_REGION_START CreateNewLogUsingFields
			// __LLBLGENPRO_USER_CODE_REGION_END
			return toReturn;
		}

		#region Included Code

		#endregion
	}
	
	/// <summary>Factory to create new, empty MailEntity objects.</summary>
	[Serializable]
	public partial class MailEntityFactory : EntityFactoryBase {
		/// <summary>CTor</summary>
		public MailEntityFactory() : base("MailEntity", CARMSData.EntityType.MailEntity) { }

		/// <summary>Creates a new, empty MailEntity object.</summary>
		/// <returns>A new, empty MailEntity object.</returns>
		public override IEntity Create() {
			IEntity toReturn = new MailEntity();
			
			// __LLBLGENPRO_USER_CODE_REGION_START CreateNewMail
			// __LLBLGENPRO_USER_CODE_REGION_END
			return toReturn;
		}
		
		/// <summary>Creates a new MailEntity instance and will set the Fields object of the new IEntity instance to the passed in fields object.</summary>
		/// <param name="fields">Populated IEntityFields object for the new IEntity to create</param>
		/// <returns>Fully created and populated (due to the IEntityFields object) IEntity object</returns>
		public override IEntity Create(IEntityFields fields) {
			IEntity toReturn = Create();
			toReturn.Fields = fields;
			
			// __LLBLGENPRO_USER_CODE_REGION_START CreateNewMailUsingFields
			// __LLBLGENPRO_USER_CODE_REGION_END
			return toReturn;
		}

		#region Included Code

		#endregion
	}
	
	/// <summary>Factory to create new, empty MailTaskEntity objects.</summary>
	[Serializable]
	public partial class MailTaskEntityFactory : EntityFactoryBase {
		/// <summary>CTor</summary>
		public MailTaskEntityFactory() : base("MailTaskEntity", CARMSData.EntityType.MailTaskEntity) { }

		/// <summary>Creates a new, empty MailTaskEntity object.</summary>
		/// <returns>A new, empty MailTaskEntity object.</returns>
		public override IEntity Create() {
			IEntity toReturn = new MailTaskEntity();
			
			// __LLBLGENPRO_USER_CODE_REGION_START CreateNewMailTask
			// __LLBLGENPRO_USER_CODE_REGION_END
			return toReturn;
		}
		
		/// <summary>Creates a new MailTaskEntity instance and will set the Fields object of the new IEntity instance to the passed in fields object.</summary>
		/// <param name="fields">Populated IEntityFields object for the new IEntity to create</param>
		/// <returns>Fully created and populated (due to the IEntityFields object) IEntity object</returns>
		public override IEntity Create(IEntityFields fields) {
			IEntity toReturn = Create();
			toReturn.Fields = fields;
			
			// __LLBLGENPRO_USER_CODE_REGION_START CreateNewMailTaskUsingFields
			// __LLBLGENPRO_USER_CODE_REGION_END
			return toReturn;
		}

		#region Included Code

		#endregion
	}
	
	/// <summary>Factory to create new, empty MessageEntity objects.</summary>
	[Serializable]
	public partial class MessageEntityFactory : EntityFactoryBase {
		/// <summary>CTor</summary>
		public MessageEntityFactory() : base("MessageEntity", CARMSData.EntityType.MessageEntity) { }

		/// <summary>Creates a new, empty MessageEntity object.</summary>
		/// <returns>A new, empty MessageEntity object.</returns>
		public override IEntity Create() {
			IEntity toReturn = new MessageEntity();
			
			// __LLBLGENPRO_USER_CODE_REGION_START CreateNewMessage
			// __LLBLGENPRO_USER_CODE_REGION_END
			return toReturn;
		}
		
		/// <summary>Creates a new MessageEntity instance and will set the Fields object of the new IEntity instance to the passed in fields object.</summary>
		/// <param name="fields">Populated IEntityFields object for the new IEntity to create</param>
		/// <returns>Fully created and populated (due to the IEntityFields object) IEntity object</returns>
		public override IEntity Create(IEntityFields fields) {
			IEntity toReturn = Create();
			toReturn.Fields = fields;
			
			// __LLBLGENPRO_USER_CODE_REGION_START CreateNewMessageUsingFields
			// __LLBLGENPRO_USER_CODE_REGION_END
			return toReturn;
		}

		#region Included Code

		#endregion
	}
	
	/// <summary>Factory to create new, empty ReportCategoryEntity objects.</summary>
	[Serializable]
	public partial class ReportCategoryEntityFactory : EntityFactoryBase {
		/// <summary>CTor</summary>
		public ReportCategoryEntityFactory() : base("ReportCategoryEntity", CARMSData.EntityType.ReportCategoryEntity) { }

		/// <summary>Creates a new, empty ReportCategoryEntity object.</summary>
		/// <returns>A new, empty ReportCategoryEntity object.</returns>
		public override IEntity Create() {
			IEntity toReturn = new ReportCategoryEntity();
			
			// __LLBLGENPRO_USER_CODE_REGION_START CreateNewReportCategory
			// __LLBLGENPRO_USER_CODE_REGION_END
			return toReturn;
		}
		
		/// <summary>Creates a new ReportCategoryEntity instance and will set the Fields object of the new IEntity instance to the passed in fields object.</summary>
		/// <param name="fields">Populated IEntityFields object for the new IEntity to create</param>
		/// <returns>Fully created and populated (due to the IEntityFields object) IEntity object</returns>
		public override IEntity Create(IEntityFields fields) {
			IEntity toReturn = Create();
			toReturn.Fields = fields;
			
			// __LLBLGENPRO_USER_CODE_REGION_START CreateNewReportCategoryUsingFields
			// __LLBLGENPRO_USER_CODE_REGION_END
			return toReturn;
		}

		#region Included Code

		#endregion
	}
	
	/// <summary>Factory to create new, empty ReportCategoryToTemplateEntity objects.</summary>
	[Serializable]
	public partial class ReportCategoryToTemplateEntityFactory : EntityFactoryBase {
		/// <summary>CTor</summary>
		public ReportCategoryToTemplateEntityFactory() : base("ReportCategoryToTemplateEntity", CARMSData.EntityType.ReportCategoryToTemplateEntity) { }

		/// <summary>Creates a new, empty ReportCategoryToTemplateEntity object.</summary>
		/// <returns>A new, empty ReportCategoryToTemplateEntity object.</returns>
		public override IEntity Create() {
			IEntity toReturn = new ReportCategoryToTemplateEntity();
			
			// __LLBLGENPRO_USER_CODE_REGION_START CreateNewReportCategoryToTemplate
			// __LLBLGENPRO_USER_CODE_REGION_END
			return toReturn;
		}
		
		/// <summary>Creates a new ReportCategoryToTemplateEntity instance and will set the Fields object of the new IEntity instance to the passed in fields object.</summary>
		/// <param name="fields">Populated IEntityFields object for the new IEntity to create</param>
		/// <returns>Fully created and populated (due to the IEntityFields object) IEntity object</returns>
		public override IEntity Create(IEntityFields fields) {
			IEntity toReturn = Create();
			toReturn.Fields = fields;
			
			// __LLBLGENPRO_USER_CODE_REGION_START CreateNewReportCategoryToTemplateUsingFields
			// __LLBLGENPRO_USER_CODE_REGION_END
			return toReturn;
		}

		#region Included Code

		#endregion
	}
	
	/// <summary>Factory to create new, empty ReportFlowEntity objects.</summary>
	[Serializable]
	public partial class ReportFlowEntityFactory : EntityFactoryBase {
		/// <summary>CTor</summary>
		public ReportFlowEntityFactory() : base("ReportFlowEntity", CARMSData.EntityType.ReportFlowEntity) { }

		/// <summary>Creates a new, empty ReportFlowEntity object.</summary>
		/// <returns>A new, empty ReportFlowEntity object.</returns>
		public override IEntity Create() {
			IEntity toReturn = new ReportFlowEntity();
			
			// __LLBLGENPRO_USER_CODE_REGION_START CreateNewReportFlow
			// __LLBLGENPRO_USER_CODE_REGION_END
			return toReturn;
		}
		
		/// <summary>Creates a new ReportFlowEntity instance and will set the Fields object of the new IEntity instance to the passed in fields object.</summary>
		/// <param name="fields">Populated IEntityFields object for the new IEntity to create</param>
		/// <returns>Fully created and populated (due to the IEntityFields object) IEntity object</returns>
		public override IEntity Create(IEntityFields fields) {
			IEntity toReturn = Create();
			toReturn.Fields = fields;
			
			// __LLBLGENPRO_USER_CODE_REGION_START CreateNewReportFlowUsingFields
			// __LLBLGENPRO_USER_CODE_REGION_END
			return toReturn;
		}

		#region Included Code

		#endregion
	}
	
	/// <summary>Factory to create new, empty ReportHeaderEntity objects.</summary>
	[Serializable]
	public partial class ReportHeaderEntityFactory : EntityFactoryBase {
		/// <summary>CTor</summary>
		public ReportHeaderEntityFactory() : base("ReportHeaderEntity", CARMSData.EntityType.ReportHeaderEntity) { }

		/// <summary>Creates a new, empty ReportHeaderEntity object.</summary>
		/// <returns>A new, empty ReportHeaderEntity object.</returns>
		public override IEntity Create() {
			IEntity toReturn = new ReportHeaderEntity();
			
			// __LLBLGENPRO_USER_CODE_REGION_START CreateNewReportHeader
			// __LLBLGENPRO_USER_CODE_REGION_END
			return toReturn;
		}
		
		/// <summary>Creates a new ReportHeaderEntity instance and will set the Fields object of the new IEntity instance to the passed in fields object.</summary>
		/// <param name="fields">Populated IEntityFields object for the new IEntity to create</param>
		/// <returns>Fully created and populated (due to the IEntityFields object) IEntity object</returns>
		public override IEntity Create(IEntityFields fields) {
			IEntity toReturn = Create();
			toReturn.Fields = fields;
			
			// __LLBLGENPRO_USER_CODE_REGION_START CreateNewReportHeaderUsingFields
			// __LLBLGENPRO_USER_CODE_REGION_END
			return toReturn;
		}

		#region Included Code

		#endregion
	}
	
	/// <summary>Factory to create new, empty ReportOneEntity objects.</summary>
	[Serializable]
	public partial class ReportOneEntityFactory : EntityFactoryBase {
		/// <summary>CTor</summary>
		public ReportOneEntityFactory() : base("ReportOneEntity", CARMSData.EntityType.ReportOneEntity) { }

		/// <summary>Creates a new, empty ReportOneEntity object.</summary>
		/// <returns>A new, empty ReportOneEntity object.</returns>
		public override IEntity Create() {
			IEntity toReturn = new ReportOneEntity();
			
			// __LLBLGENPRO_USER_CODE_REGION_START CreateNewReportOne
			// __LLBLGENPRO_USER_CODE_REGION_END
			return toReturn;
		}
		
		/// <summary>Creates a new ReportOneEntity instance and will set the Fields object of the new IEntity instance to the passed in fields object.</summary>
		/// <param name="fields">Populated IEntityFields object for the new IEntity to create</param>
		/// <returns>Fully created and populated (due to the IEntityFields object) IEntity object</returns>
		public override IEntity Create(IEntityFields fields) {
			IEntity toReturn = Create();
			toReturn.Fields = fields;
			
			// __LLBLGENPRO_USER_CODE_REGION_START CreateNewReportOneUsingFields
			// __LLBLGENPRO_USER_CODE_REGION_END
			return toReturn;
		}

		#region Included Code

		#endregion
	}
	
	/// <summary>Factory to create new, empty ReportPropertyEntity objects.</summary>
	[Serializable]
	public partial class ReportPropertyEntityFactory : EntityFactoryBase {
		/// <summary>CTor</summary>
		public ReportPropertyEntityFactory() : base("ReportPropertyEntity", CARMSData.EntityType.ReportPropertyEntity) { }

		/// <summary>Creates a new, empty ReportPropertyEntity object.</summary>
		/// <returns>A new, empty ReportPropertyEntity object.</returns>
		public override IEntity Create() {
			IEntity toReturn = new ReportPropertyEntity();
			
			// __LLBLGENPRO_USER_CODE_REGION_START CreateNewReportProperty
			// __LLBLGENPRO_USER_CODE_REGION_END
			return toReturn;
		}
		
		/// <summary>Creates a new ReportPropertyEntity instance and will set the Fields object of the new IEntity instance to the passed in fields object.</summary>
		/// <param name="fields">Populated IEntityFields object for the new IEntity to create</param>
		/// <returns>Fully created and populated (due to the IEntityFields object) IEntity object</returns>
		public override IEntity Create(IEntityFields fields) {
			IEntity toReturn = Create();
			toReturn.Fields = fields;
			
			// __LLBLGENPRO_USER_CODE_REGION_START CreateNewReportPropertyUsingFields
			// __LLBLGENPRO_USER_CODE_REGION_END
			return toReturn;
		}

		#region Included Code

		#endregion
	}
	
	/// <summary>Factory to create new, empty ReportStatusToButtonEventEntity objects.</summary>
	[Serializable]
	public partial class ReportStatusToButtonEventEntityFactory : EntityFactoryBase {
		/// <summary>CTor</summary>
		public ReportStatusToButtonEventEntityFactory() : base("ReportStatusToButtonEventEntity", CARMSData.EntityType.ReportStatusToButtonEventEntity) { }

		/// <summary>Creates a new, empty ReportStatusToButtonEventEntity object.</summary>
		/// <returns>A new, empty ReportStatusToButtonEventEntity object.</returns>
		public override IEntity Create() {
			IEntity toReturn = new ReportStatusToButtonEventEntity();
			
			// __LLBLGENPRO_USER_CODE_REGION_START CreateNewReportStatusToButtonEvent
			// __LLBLGENPRO_USER_CODE_REGION_END
			return toReturn;
		}
		
		/// <summary>Creates a new ReportStatusToButtonEventEntity instance and will set the Fields object of the new IEntity instance to the passed in fields object.</summary>
		/// <param name="fields">Populated IEntityFields object for the new IEntity to create</param>
		/// <returns>Fully created and populated (due to the IEntityFields object) IEntity object</returns>
		public override IEntity Create(IEntityFields fields) {
			IEntity toReturn = Create();
			toReturn.Fields = fields;
			
			// __LLBLGENPRO_USER_CODE_REGION_START CreateNewReportStatusToButtonEventUsingFields
			// __LLBLGENPRO_USER_CODE_REGION_END
			return toReturn;
		}

		#region Included Code

		#endregion
	}
	
	/// <summary>Factory to create new, empty ReportTwoEntity objects.</summary>
	[Serializable]
	public partial class ReportTwoEntityFactory : EntityFactoryBase {
		/// <summary>CTor</summary>
		public ReportTwoEntityFactory() : base("ReportTwoEntity", CARMSData.EntityType.ReportTwoEntity) { }

		/// <summary>Creates a new, empty ReportTwoEntity object.</summary>
		/// <returns>A new, empty ReportTwoEntity object.</returns>
		public override IEntity Create() {
			IEntity toReturn = new ReportTwoEntity();
			
			// __LLBLGENPRO_USER_CODE_REGION_START CreateNewReportTwo
			// __LLBLGENPRO_USER_CODE_REGION_END
			return toReturn;
		}
		
		/// <summary>Creates a new ReportTwoEntity instance and will set the Fields object of the new IEntity instance to the passed in fields object.</summary>
		/// <param name="fields">Populated IEntityFields object for the new IEntity to create</param>
		/// <returns>Fully created and populated (due to the IEntityFields object) IEntity object</returns>
		public override IEntity Create(IEntityFields fields) {
			IEntity toReturn = Create();
			toReturn.Fields = fields;
			
			// __LLBLGENPRO_USER_CODE_REGION_START CreateNewReportTwoUsingFields
			// __LLBLGENPRO_USER_CODE_REGION_END
			return toReturn;
		}

		#region Included Code

		#endregion
	}
	
	/// <summary>Factory to create new, empty ReportValueEntity objects.</summary>
	[Serializable]
	public partial class ReportValueEntityFactory : EntityFactoryBase {
		/// <summary>CTor</summary>
		public ReportValueEntityFactory() : base("ReportValueEntity", CARMSData.EntityType.ReportValueEntity) { }

		/// <summary>Creates a new, empty ReportValueEntity object.</summary>
		/// <returns>A new, empty ReportValueEntity object.</returns>
		public override IEntity Create() {
			IEntity toReturn = new ReportValueEntity();
			
			// __LLBLGENPRO_USER_CODE_REGION_START CreateNewReportValue
			// __LLBLGENPRO_USER_CODE_REGION_END
			return toReturn;
		}
		
		/// <summary>Creates a new ReportValueEntity instance and will set the Fields object of the new IEntity instance to the passed in fields object.</summary>
		/// <param name="fields">Populated IEntityFields object for the new IEntity to create</param>
		/// <returns>Fully created and populated (due to the IEntityFields object) IEntity object</returns>
		public override IEntity Create(IEntityFields fields) {
			IEntity toReturn = Create();
			toReturn.Fields = fields;
			
			// __LLBLGENPRO_USER_CODE_REGION_START CreateNewReportValueUsingFields
			// __LLBLGENPRO_USER_CODE_REGION_END
			return toReturn;
		}

		#region Included Code

		#endregion
	}
	
	/// <summary>Factory to create new, empty RoleEntity objects.</summary>
	[Serializable]
	public partial class RoleEntityFactory : EntityFactoryBase {
		/// <summary>CTor</summary>
		public RoleEntityFactory() : base("RoleEntity", CARMSData.EntityType.RoleEntity) { }

		/// <summary>Creates a new, empty RoleEntity object.</summary>
		/// <returns>A new, empty RoleEntity object.</returns>
		public override IEntity Create() {
			IEntity toReturn = new RoleEntity();
			
			// __LLBLGENPRO_USER_CODE_REGION_START CreateNewRole
			// __LLBLGENPRO_USER_CODE_REGION_END
			return toReturn;
		}
		
		/// <summary>Creates a new RoleEntity instance and will set the Fields object of the new IEntity instance to the passed in fields object.</summary>
		/// <param name="fields">Populated IEntityFields object for the new IEntity to create</param>
		/// <returns>Fully created and populated (due to the IEntityFields object) IEntity object</returns>
		public override IEntity Create(IEntityFields fields) {
			IEntity toReturn = Create();
			toReturn.Fields = fields;
			
			// __LLBLGENPRO_USER_CODE_REGION_START CreateNewRoleUsingFields
			// __LLBLGENPRO_USER_CODE_REGION_END
			return toReturn;
		}

		#region Included Code

		#endregion
	}
	
	/// <summary>Factory to create new, empty RoleActionEntity objects.</summary>
	[Serializable]
	public partial class RoleActionEntityFactory : EntityFactoryBase {
		/// <summary>CTor</summary>
		public RoleActionEntityFactory() : base("RoleActionEntity", CARMSData.EntityType.RoleActionEntity) { }

		/// <summary>Creates a new, empty RoleActionEntity object.</summary>
		/// <returns>A new, empty RoleActionEntity object.</returns>
		public override IEntity Create() {
			IEntity toReturn = new RoleActionEntity();
			
			// __LLBLGENPRO_USER_CODE_REGION_START CreateNewRoleAction
			// __LLBLGENPRO_USER_CODE_REGION_END
			return toReturn;
		}
		
		/// <summary>Creates a new RoleActionEntity instance and will set the Fields object of the new IEntity instance to the passed in fields object.</summary>
		/// <param name="fields">Populated IEntityFields object for the new IEntity to create</param>
		/// <returns>Fully created and populated (due to the IEntityFields object) IEntity object</returns>
		public override IEntity Create(IEntityFields fields) {
			IEntity toReturn = Create();
			toReturn.Fields = fields;
			
			// __LLBLGENPRO_USER_CODE_REGION_START CreateNewRoleActionUsingFields
			// __LLBLGENPRO_USER_CODE_REGION_END
			return toReturn;
		}

		#region Included Code

		#endregion
	}
	
	/// <summary>Factory to create new, empty SalaryLevelEntity objects.</summary>
	[Serializable]
	public partial class SalaryLevelEntityFactory : EntityFactoryBase {
		/// <summary>CTor</summary>
		public SalaryLevelEntityFactory() : base("SalaryLevelEntity", CARMSData.EntityType.SalaryLevelEntity) { }

		/// <summary>Creates a new, empty SalaryLevelEntity object.</summary>
		/// <returns>A new, empty SalaryLevelEntity object.</returns>
		public override IEntity Create() {
			IEntity toReturn = new SalaryLevelEntity();
			
			// __LLBLGENPRO_USER_CODE_REGION_START CreateNewSalaryLevel
			// __LLBLGENPRO_USER_CODE_REGION_END
			return toReturn;
		}
		
		/// <summary>Creates a new SalaryLevelEntity instance and will set the Fields object of the new IEntity instance to the passed in fields object.</summary>
		/// <param name="fields">Populated IEntityFields object for the new IEntity to create</param>
		/// <returns>Fully created and populated (due to the IEntityFields object) IEntity object</returns>
		public override IEntity Create(IEntityFields fields) {
			IEntity toReturn = Create();
			toReturn.Fields = fields;
			
			// __LLBLGENPRO_USER_CODE_REGION_START CreateNewSalaryLevelUsingFields
			// __LLBLGENPRO_USER_CODE_REGION_END
			return toReturn;
		}

		#region Included Code

		#endregion
	}
	
	/// <summary>Factory to create new, empty TemplateEntity objects.</summary>
	[Serializable]
	public partial class TemplateEntityFactory : EntityFactoryBase {
		/// <summary>CTor</summary>
		public TemplateEntityFactory() : base("TemplateEntity", CARMSData.EntityType.TemplateEntity) { }

		/// <summary>Creates a new, empty TemplateEntity object.</summary>
		/// <returns>A new, empty TemplateEntity object.</returns>
		public override IEntity Create() {
			IEntity toReturn = new TemplateEntity();
			
			// __LLBLGENPRO_USER_CODE_REGION_START CreateNewTemplate
			// __LLBLGENPRO_USER_CODE_REGION_END
			return toReturn;
		}
		
		/// <summary>Creates a new TemplateEntity instance and will set the Fields object of the new IEntity instance to the passed in fields object.</summary>
		/// <param name="fields">Populated IEntityFields object for the new IEntity to create</param>
		/// <returns>Fully created and populated (due to the IEntityFields object) IEntity object</returns>
		public override IEntity Create(IEntityFields fields) {
			IEntity toReturn = Create();
			toReturn.Fields = fields;
			
			// __LLBLGENPRO_USER_CODE_REGION_START CreateNewTemplateUsingFields
			// __LLBLGENPRO_USER_CODE_REGION_END
			return toReturn;
		}

		#region Included Code

		#endregion
	}
	
	/// <summary>Factory to create new, empty TemplateToReportCategoryEntity objects.</summary>
	[Serializable]
	public partial class TemplateToReportCategoryEntityFactory : EntityFactoryBase {
		/// <summary>CTor</summary>
		public TemplateToReportCategoryEntityFactory() : base("TemplateToReportCategoryEntity", CARMSData.EntityType.TemplateToReportCategoryEntity) { }

		/// <summary>Creates a new, empty TemplateToReportCategoryEntity object.</summary>
		/// <returns>A new, empty TemplateToReportCategoryEntity object.</returns>
		public override IEntity Create() {
			IEntity toReturn = new TemplateToReportCategoryEntity();
			
			// __LLBLGENPRO_USER_CODE_REGION_START CreateNewTemplateToReportCategory
			// __LLBLGENPRO_USER_CODE_REGION_END
			return toReturn;
		}
		
		/// <summary>Creates a new TemplateToReportCategoryEntity instance and will set the Fields object of the new IEntity instance to the passed in fields object.</summary>
		/// <param name="fields">Populated IEntityFields object for the new IEntity to create</param>
		/// <returns>Fully created and populated (due to the IEntityFields object) IEntity object</returns>
		public override IEntity Create(IEntityFields fields) {
			IEntity toReturn = Create();
			toReturn.Fields = fields;
			
			// __LLBLGENPRO_USER_CODE_REGION_START CreateNewTemplateToReportCategoryUsingFields
			// __LLBLGENPRO_USER_CODE_REGION_END
			return toReturn;
		}

		#region Included Code

		#endregion
	}
	
	/// <summary>Factory to create new, empty UserEntity objects.</summary>
	[Serializable]
	public partial class UserEntityFactory : EntityFactoryBase {
		/// <summary>CTor</summary>
		public UserEntityFactory() : base("UserEntity", CARMSData.EntityType.UserEntity) { }

		/// <summary>Creates a new, empty UserEntity object.</summary>
		/// <returns>A new, empty UserEntity object.</returns>
		public override IEntity Create() {
			IEntity toReturn = new UserEntity();
			
			// __LLBLGENPRO_USER_CODE_REGION_START CreateNewUser
			// __LLBLGENPRO_USER_CODE_REGION_END
			return toReturn;
		}
		
		/// <summary>Creates a new UserEntity instance and will set the Fields object of the new IEntity instance to the passed in fields object.</summary>
		/// <param name="fields">Populated IEntityFields object for the new IEntity to create</param>
		/// <returns>Fully created and populated (due to the IEntityFields object) IEntity object</returns>
		public override IEntity Create(IEntityFields fields) {
			IEntity toReturn = Create();
			toReturn.Fields = fields;
			
			// __LLBLGENPRO_USER_CODE_REGION_START CreateNewUserUsingFields
			// __LLBLGENPRO_USER_CODE_REGION_END
			return toReturn;
		}

		#region Included Code

		#endregion
	}
	
	/// <summary>Factory to create new, empty UserActionEntity objects.</summary>
	[Serializable]
	public partial class UserActionEntityFactory : EntityFactoryBase {
		/// <summary>CTor</summary>
		public UserActionEntityFactory() : base("UserActionEntity", CARMSData.EntityType.UserActionEntity) { }

		/// <summary>Creates a new, empty UserActionEntity object.</summary>
		/// <returns>A new, empty UserActionEntity object.</returns>
		public override IEntity Create() {
			IEntity toReturn = new UserActionEntity();
			
			// __LLBLGENPRO_USER_CODE_REGION_START CreateNewUserAction
			// __LLBLGENPRO_USER_CODE_REGION_END
			return toReturn;
		}
		
		/// <summary>Creates a new UserActionEntity instance and will set the Fields object of the new IEntity instance to the passed in fields object.</summary>
		/// <param name="fields">Populated IEntityFields object for the new IEntity to create</param>
		/// <returns>Fully created and populated (due to the IEntityFields object) IEntity object</returns>
		public override IEntity Create(IEntityFields fields) {
			IEntity toReturn = Create();
			toReturn.Fields = fields;
			
			// __LLBLGENPRO_USER_CODE_REGION_START CreateNewUserActionUsingFields
			// __LLBLGENPRO_USER_CODE_REGION_END
			return toReturn;
		}

		#region Included Code

		#endregion
	}
	
	/// <summary>Factory to create new, empty UserPermissionEntity objects.</summary>
	[Serializable]
	public partial class UserPermissionEntityFactory : EntityFactoryBase {
		/// <summary>CTor</summary>
		public UserPermissionEntityFactory() : base("UserPermissionEntity", CARMSData.EntityType.UserPermissionEntity) { }

		/// <summary>Creates a new, empty UserPermissionEntity object.</summary>
		/// <returns>A new, empty UserPermissionEntity object.</returns>
		public override IEntity Create() {
			IEntity toReturn = new UserPermissionEntity();
			
			// __LLBLGENPRO_USER_CODE_REGION_START CreateNewUserPermission
			// __LLBLGENPRO_USER_CODE_REGION_END
			return toReturn;
		}
		
		/// <summary>Creates a new UserPermissionEntity instance and will set the Fields object of the new IEntity instance to the passed in fields object.</summary>
		/// <param name="fields">Populated IEntityFields object for the new IEntity to create</param>
		/// <returns>Fully created and populated (due to the IEntityFields object) IEntity object</returns>
		public override IEntity Create(IEntityFields fields) {
			IEntity toReturn = Create();
			toReturn.Fields = fields;
			
			// __LLBLGENPRO_USER_CODE_REGION_START CreateNewUserPermissionUsingFields
			// __LLBLGENPRO_USER_CODE_REGION_END
			return toReturn;
		}

		#region Included Code

		#endregion
	}
	
	/// <summary>Factory to create new, empty UserRoleEntity objects.</summary>
	[Serializable]
	public partial class UserRoleEntityFactory : EntityFactoryBase {
		/// <summary>CTor</summary>
		public UserRoleEntityFactory() : base("UserRoleEntity", CARMSData.EntityType.UserRoleEntity) { }

		/// <summary>Creates a new, empty UserRoleEntity object.</summary>
		/// <returns>A new, empty UserRoleEntity object.</returns>
		public override IEntity Create() {
			IEntity toReturn = new UserRoleEntity();
			
			// __LLBLGENPRO_USER_CODE_REGION_START CreateNewUserRole
			// __LLBLGENPRO_USER_CODE_REGION_END
			return toReturn;
		}
		
		/// <summary>Creates a new UserRoleEntity instance and will set the Fields object of the new IEntity instance to the passed in fields object.</summary>
		/// <param name="fields">Populated IEntityFields object for the new IEntity to create</param>
		/// <returns>Fully created and populated (due to the IEntityFields object) IEntity object</returns>
		public override IEntity Create(IEntityFields fields) {
			IEntity toReturn = Create();
			toReturn.Fields = fields;
			
			// __LLBLGENPRO_USER_CODE_REGION_START CreateNewUserRoleUsingFields
			// __LLBLGENPRO_USER_CODE_REGION_END
			return toReturn;
		}

		#region Included Code

		#endregion
	}

	/// <summary>Factory to create new entity collection objects</summary>
	[Serializable]
	public partial class GeneralEntityCollectionFactory
	{
		/// <summary>Creates a new entity collection</summary>
		/// <param name="typeToUse">The entity type to create the collection for.</param>
		/// <returns>A new entity collection object.</returns>
		public static IEntityCollection Create(CARMSData.EntityType typeToUse)
		{
			switch(typeToUse)
			{
				case CARMSData.EntityType.ActionEntity:
					return new ActionCollection();
				case CARMSData.EntityType.ActionGridColumnEntity:
					return new ActionGridColumnCollection();
				case CARMSData.EntityType.ColumnToActionEntity:
					return new ColumnToActionCollection();
				case CARMSData.EntityType.CompanyEntity:
					return new CompanyCollection();
				case CARMSData.EntityType.ConfigurationEntity:
					return new ConfigurationCollection();
				case CARMSData.EntityType.CountryEntity:
					return new CountryCollection();
				case CARMSData.EntityType.CustomerEntity:
					return new CustomerCollection();
				case CARMSData.EntityType.DepartmentEntity:
					return new DepartmentCollection();
				case CARMSData.EntityType.DictionaryEntity:
					return new DictionaryCollection();
				case CARMSData.EntityType.DictionaryCategoryEntity:
					return new DictionaryCategoryCollection();
				case CARMSData.EntityType.G100Entity:
					return new G100Collection();
				case CARMSData.EntityType.G102Entity:
					return new G102Collection();
				case CARMSData.EntityType.G103Entity:
					return new G103Collection();
				case CARMSData.EntityType.G131Entity:
					return new G131Collection();
				case CARMSData.EntityType.G132Entity:
					return new G132Collection();
				case CARMSData.EntityType.GlossaryEntity:
					return new GlossaryCollection();
				case CARMSData.EntityType.LogEntity:
					return new LogCollection();
				case CARMSData.EntityType.MailEntity:
					return new MailCollection();
				case CARMSData.EntityType.MailTaskEntity:
					return new MailTaskCollection();
				case CARMSData.EntityType.MessageEntity:
					return new MessageCollection();
				case CARMSData.EntityType.ReportCategoryEntity:
					return new ReportCategoryCollection();
				case CARMSData.EntityType.ReportCategoryToTemplateEntity:
					return new ReportCategoryToTemplateCollection();
				case CARMSData.EntityType.ReportFlowEntity:
					return new ReportFlowCollection();
				case CARMSData.EntityType.ReportHeaderEntity:
					return new ReportHeaderCollection();
				case CARMSData.EntityType.ReportOneEntity:
					return new ReportOneCollection();
				case CARMSData.EntityType.ReportPropertyEntity:
					return new ReportPropertyCollection();
				case CARMSData.EntityType.ReportStatusToButtonEventEntity:
					return new ReportStatusToButtonEventCollection();
				case CARMSData.EntityType.ReportTwoEntity:
					return new ReportTwoCollection();
				case CARMSData.EntityType.ReportValueEntity:
					return new ReportValueCollection();
				case CARMSData.EntityType.RoleEntity:
					return new RoleCollection();
				case CARMSData.EntityType.RoleActionEntity:
					return new RoleActionCollection();
				case CARMSData.EntityType.SalaryLevelEntity:
					return new SalaryLevelCollection();
				case CARMSData.EntityType.TemplateEntity:
					return new TemplateCollection();
				case CARMSData.EntityType.TemplateToReportCategoryEntity:
					return new TemplateToReportCategoryCollection();
				case CARMSData.EntityType.UserEntity:
					return new UserCollection();
				case CARMSData.EntityType.UserActionEntity:
					return new UserActionCollection();
				case CARMSData.EntityType.UserPermissionEntity:
					return new UserPermissionCollection();
				case CARMSData.EntityType.UserRoleEntity:
					return new UserRoleCollection();
				default:
					return null;
			}
		}		
	}
	
	/// <summary>Factory to create new, empty Entity objects based on the entity type specified. Uses entity specific factory objects</summary>
	[Serializable]
	public partial class GeneralEntityFactory
	{
		/// <summary>Creates a new, empty Entity object of the type specified</summary>
		/// <param name="entityTypeToCreate">The entity type to create.</param>
		/// <returns>A new, empty Entity object.</returns>
		public static IEntity Create(CARMSData.EntityType entityTypeToCreate)
		{
			IEntityFactory factoryToUse = null;
			switch(entityTypeToCreate)
			{
				case CARMSData.EntityType.ActionEntity:
					factoryToUse = new ActionEntityFactory();
					break;
				case CARMSData.EntityType.ActionGridColumnEntity:
					factoryToUse = new ActionGridColumnEntityFactory();
					break;
				case CARMSData.EntityType.ColumnToActionEntity:
					factoryToUse = new ColumnToActionEntityFactory();
					break;
				case CARMSData.EntityType.CompanyEntity:
					factoryToUse = new CompanyEntityFactory();
					break;
				case CARMSData.EntityType.ConfigurationEntity:
					factoryToUse = new ConfigurationEntityFactory();
					break;
				case CARMSData.EntityType.CountryEntity:
					factoryToUse = new CountryEntityFactory();
					break;
				case CARMSData.EntityType.CustomerEntity:
					factoryToUse = new CustomerEntityFactory();
					break;
				case CARMSData.EntityType.DepartmentEntity:
					factoryToUse = new DepartmentEntityFactory();
					break;
				case CARMSData.EntityType.DictionaryEntity:
					factoryToUse = new DictionaryEntityFactory();
					break;
				case CARMSData.EntityType.DictionaryCategoryEntity:
					factoryToUse = new DictionaryCategoryEntityFactory();
					break;
				case CARMSData.EntityType.G100Entity:
					factoryToUse = new G100EntityFactory();
					break;
				case CARMSData.EntityType.G102Entity:
					factoryToUse = new G102EntityFactory();
					break;
				case CARMSData.EntityType.G103Entity:
					factoryToUse = new G103EntityFactory();
					break;
				case CARMSData.EntityType.G131Entity:
					factoryToUse = new G131EntityFactory();
					break;
				case CARMSData.EntityType.G132Entity:
					factoryToUse = new G132EntityFactory();
					break;
				case CARMSData.EntityType.GlossaryEntity:
					factoryToUse = new GlossaryEntityFactory();
					break;
				case CARMSData.EntityType.LogEntity:
					factoryToUse = new LogEntityFactory();
					break;
				case CARMSData.EntityType.MailEntity:
					factoryToUse = new MailEntityFactory();
					break;
				case CARMSData.EntityType.MailTaskEntity:
					factoryToUse = new MailTaskEntityFactory();
					break;
				case CARMSData.EntityType.MessageEntity:
					factoryToUse = new MessageEntityFactory();
					break;
				case CARMSData.EntityType.ReportCategoryEntity:
					factoryToUse = new ReportCategoryEntityFactory();
					break;
				case CARMSData.EntityType.ReportCategoryToTemplateEntity:
					factoryToUse = new ReportCategoryToTemplateEntityFactory();
					break;
				case CARMSData.EntityType.ReportFlowEntity:
					factoryToUse = new ReportFlowEntityFactory();
					break;
				case CARMSData.EntityType.ReportHeaderEntity:
					factoryToUse = new ReportHeaderEntityFactory();
					break;
				case CARMSData.EntityType.ReportOneEntity:
					factoryToUse = new ReportOneEntityFactory();
					break;
				case CARMSData.EntityType.ReportPropertyEntity:
					factoryToUse = new ReportPropertyEntityFactory();
					break;
				case CARMSData.EntityType.ReportStatusToButtonEventEntity:
					factoryToUse = new ReportStatusToButtonEventEntityFactory();
					break;
				case CARMSData.EntityType.ReportTwoEntity:
					factoryToUse = new ReportTwoEntityFactory();
					break;
				case CARMSData.EntityType.ReportValueEntity:
					factoryToUse = new ReportValueEntityFactory();
					break;
				case CARMSData.EntityType.RoleEntity:
					factoryToUse = new RoleEntityFactory();
					break;
				case CARMSData.EntityType.RoleActionEntity:
					factoryToUse = new RoleActionEntityFactory();
					break;
				case CARMSData.EntityType.SalaryLevelEntity:
					factoryToUse = new SalaryLevelEntityFactory();
					break;
				case CARMSData.EntityType.TemplateEntity:
					factoryToUse = new TemplateEntityFactory();
					break;
				case CARMSData.EntityType.TemplateToReportCategoryEntity:
					factoryToUse = new TemplateToReportCategoryEntityFactory();
					break;
				case CARMSData.EntityType.UserEntity:
					factoryToUse = new UserEntityFactory();
					break;
				case CARMSData.EntityType.UserActionEntity:
					factoryToUse = new UserActionEntityFactory();
					break;
				case CARMSData.EntityType.UserPermissionEntity:
					factoryToUse = new UserPermissionEntityFactory();
					break;
				case CARMSData.EntityType.UserRoleEntity:
					factoryToUse = new UserRoleEntityFactory();
					break;
			}
			IEntity toReturn = null;
			if(factoryToUse != null)
			{
				toReturn = factoryToUse.Create();
			}
			return toReturn;
		}		
	}
	
	/// <summary>Class which is used to obtain the entity factory based on the .NET type of the entity. </summary>
	[Serializable]
	public static class EntityFactoryFactory
	{
#if CF
		/// <summary>Gets the factory of the entity with the CARMSData.EntityType specified</summary>
		/// <param name="typeOfEntity">The type of entity.</param>
		/// <returns>factory to use or null if not found</returns>
		public static IEntityFactory GetFactory(CARMSData.EntityType typeOfEntity)
		{
			return GeneralEntityFactory.Create(typeOfEntity).GetEntityFactory();
		}
#else
		private static Dictionary<Type, IEntityFactory> _factoryPerType = new Dictionary<Type, IEntityFactory>();

		/// <summary>Initializes the <see cref="EntityFactoryFactory"/> class.</summary>
		static EntityFactoryFactory()
		{
			Array entityTypeValues = Enum.GetValues(typeof(CARMSData.EntityType));
			foreach(int entityTypeValue in entityTypeValues)
			{
				IEntity dummy = GeneralEntityFactory.Create((CARMSData.EntityType)entityTypeValue);
				_factoryPerType.Add(dummy.GetType(), dummy.GetEntityFactory());
			}
		}

		/// <summary>Gets the factory of the entity with the .NET type specified</summary>
		/// <param name="typeOfEntity">The type of entity.</param>
		/// <returns>factory to use or null if not found</returns>
		public static IEntityFactory GetFactory(Type typeOfEntity)
		{
			IEntityFactory toReturn = null;
			_factoryPerType.TryGetValue(typeOfEntity, out toReturn);
			return toReturn;
		}

		/// <summary>Gets the factory of the entity with the CARMSData.EntityType specified</summary>
		/// <param name="typeOfEntity">The type of entity.</param>
		/// <returns>factory to use or null if not found</returns>
		public static IEntityFactory GetFactory(CARMSData.EntityType typeOfEntity)
		{
			return GetFactory(GeneralEntityFactory.Create(typeOfEntity).GetType());
		}
#endif
	}
	
	/// <summary>Element creator for creating project elements from somewhere else, like inside Linq providers.</summary>
	public class ElementCreator : ElementCreatorBase, IElementCreator
	{
		/// <summary>Gets the factory of the Entity type with the CARMSData.EntityType value passed in</summary>
		/// <param name="entityTypeValue">The entity type value.</param>
		/// <returns>the entity factory of the entity type or null if not found</returns>
		public IEntityFactory GetFactory(int entityTypeValue)
		{
			return (IEntityFactory)this.GetFactoryImpl(entityTypeValue);
		}

		/// <summary>Gets the factory of the Entity type with the .NET type passed in</summary>
		/// <param name="typeOfEntity">The type of entity.</param>
		/// <returns>the entity factory of the entity type or null if not found</returns>
		public IEntityFactory GetFactory(Type typeOfEntity)
		{
			return (IEntityFactory)this.GetFactoryImpl(typeOfEntity);
		}

		/// <summary>Creates a new resultset fields object with the number of field slots reserved as specified</summary>
		/// <param name="numberOfFields">The number of fields.</param>
		/// <returns>ready to use resultsetfields object</returns>
		public IEntityFields CreateResultsetFields(int numberOfFields)
		{
			return new ResultsetFields(numberOfFields);
		}
		
		/// <summary>Gets an instance of the TypedListDAO class to execute dynamic lists and projections.</summary>
		/// <returns>ready to use typedlistDAO</returns>
		public IDao GetTypedListDao()
		{
			return new TypedListDAO();
		}
		
		/// <summary>Creates a new dynamic relation instance</summary>
		/// <param name="leftOperand">The left operand.</param>
		/// <returns>ready to use dynamic relation</returns>
		public override IDynamicRelation CreateDynamicRelation(DerivedTableDefinition leftOperand)
		{
			return new DynamicRelation(leftOperand);
		}

		/// <summary>Creates a new dynamic relation instance</summary>
		/// <param name="leftOperand">The left operand.</param>
		/// <param name="joinType">Type of the join. If None is specified, Inner is assumed.</param>
		/// <param name="rightOperand">The right operand.</param>
		/// <param name="onClause">The on clause for the join.</param>
		/// <returns>ready to use dynamic relation</returns>
		public override IDynamicRelation CreateDynamicRelation(DerivedTableDefinition leftOperand, JoinHint joinType, DerivedTableDefinition rightOperand, IPredicate onClause)
		{
			return new DynamicRelation(leftOperand, joinType, rightOperand, onClause);
		}

		/// <summary>Creates a new dynamic relation instance</summary>
		/// <param name="leftOperand">The left operand.</param>
		/// <param name="joinType">Type of the join. If None is specified, Inner is assumed.</param>
		/// <param name="rightOperandEntityName">Name of the entity, which is used as the right operand.</param>
		/// <param name="aliasRightOperand">The alias of the right operand. If you don't want to / need to alias the right operand (only alias if you have to), specify string.Empty.</param>
		/// <param name="onClause">The on clause for the join.</param>
		/// <returns>ready to use dynamic relation</returns>
		public override IDynamicRelation CreateDynamicRelation(DerivedTableDefinition leftOperand, JoinHint joinType, string rightOperandEntityName, string aliasRightOperand, IPredicate onClause)
		{
			return new DynamicRelation(leftOperand, joinType, (CARMSData.EntityType)Enum.Parse(typeof(CARMSData.EntityType), rightOperandEntityName, false), aliasRightOperand, onClause);
		}

		/// <summary>Creates a new dynamic relation instance</summary>
		/// <param name="leftOperandEntityName">Name of the entity which is used as the left operand.</param>
		/// <param name="joinType">Type of the join. If None is specified, Inner is assumed.</param>
		/// <param name="rightOperandEntityName">Name of the entity, which is used as the right operand.</param>
		/// <param name="aliasLeftOperand">The alias of the left operand. If you don't want to / need to alias the right operand (only alias if you have to), specify string.Empty.</param>
		/// <param name="aliasRightOperand">The alias of the right operand. If you don't want to / need to alias the right operand (only alias if you have to), specify string.Empty.</param>
		/// <param name="onClause">The on clause for the join.</param>
		/// <returns>ready to use dynamic relation</returns>
		public override IDynamicRelation CreateDynamicRelation(string leftOperandEntityName, JoinHint joinType, string rightOperandEntityName, string aliasLeftOperand, string aliasRightOperand, IPredicate onClause)
		{
			return new DynamicRelation((CARMSData.EntityType)Enum.Parse(typeof(CARMSData.EntityType), leftOperandEntityName, false), joinType, (CARMSData.EntityType)Enum.Parse(typeof(CARMSData.EntityType), rightOperandEntityName, false), aliasLeftOperand, aliasRightOperand, onClause);
		}
				
		/// <summary>Obtains the inheritance info provider instance from the singleton </summary>
		/// <returns>The singleton instance of the inheritance info provider</returns>
		public override IInheritanceInfoProvider ObtainInheritanceInfoProviderInstance()
		{
			return InheritanceInfoProviderSingleton.GetInstance();
		}

		/// <summary>Implementation of the routine which gets the factory of the Entity type with the CARMSData.EntityType value passed in</summary>
		/// <param name="entityTypeValue">The entity type value.</param>
		/// <returns>the entity factory of the entity type or null if not found</returns>
		protected override IEntityFactoryCore GetFactoryImpl(int entityTypeValue)
		{
			return EntityFactoryFactory.GetFactory((CARMSData.EntityType)entityTypeValue);
		}
#if !CF		
		/// <summary>Implementation of the routine which gets the factory of the Entity type with the .NET type passed in</summary>
		/// <param name="typeOfEntity">The type of entity.</param>
		/// <returns>the entity factory of the entity type or null if not found</returns>
		protected override IEntityFactoryCore GetFactoryImpl(Type typeOfEntity)
		{
			return EntityFactoryFactory.GetFactory(typeOfEntity);
		}
#endif
	}
}
